/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package All.BO;

import All.DTO.SanphamDTO;
import All.Mapper.SanphamMapper;
import java.util.ArrayList;

/**
 *
 * @author NGUYEN DANG
 */
public class SanphamBO {
    public SanphamBO()
    {    }

    public ArrayList<SanphamDTO> listSanpham(String id) throws Exception {
        SanphamMapper mapper = null;
		try {
			mapper = new SanphamMapper();
			return mapper.listSanpham(id);
		}
		catch (Exception e) {
			throw e;
		}
    }

    public SanphamDTO getNewsInformation(String matin) throws Exception 
    {
            SanphamMapper mapper = null;
            int matintuc = Integer.parseInt(matin);
            try {
                    mapper = new SanphamMapper();
                    return mapper.getNewsInformation(matintuc);
            }
            catch (Exception e) {
                    throw e;
            }
    }

    public boolean ADDeleteItem(String matin) throws Exception {
        boolean found = false;
        SanphamMapper mapper = null;
        try{
            mapper = new SanphamMapper();
            found = mapper.ADDeleteItem(matin);
        }
        catch(Exception e)
        {
            throw e;
        }
        return found;
    }

    public boolean ADUpdateItem(SanphamDTO sanphamDTO) throws Exception {
        boolean found = false;
        SanphamMapper mapper = null;
        try{
            mapper = new SanphamMapper();
            found = mapper.ADUpdateItem(sanphamDTO);
        }
        catch(Exception e)
        {
            throw e;
        }
        return found ;
    }

    public boolean InsertItem(SanphamDTO sanphamDTO) throws Exception {
        boolean found = false;
        SanphamMapper mapper = null;
        try{
            mapper = new SanphamMapper();
            found = mapper.InsertItem(sanphamDTO);
        }
        catch(Exception e)
        {
            throw e;
        }
        return found ;
    }
    
}
